<?php

namespace App\Http\Middleware;

use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;

class TrustProxies extends Middleware
{
    /**
     * 在 Laravel 中，TrustProxies 中间件用于配置应用以信任特定的代理服务器。这对于那些部署在负载均衡器后面的 Laravel 应用来说是至关重要的，
     * 因为在这种情况下，用户的实际 IP 地址会被代理服务器的 IP 地址所掩盖。通过正确配置 TrustProxies 中间件，
     * 你可以确保 Laravel 正确地解析出客户端的真实 IP 地址以及其他头部信息
     *
     * @var array<int, string>|string|null
     */
    protected $proxies;

    /**
     * The headers that should be used to detect proxies.
     *
     * @var int
     */
    protected $headers =
        Request::HEADER_X_FORWARDED_FOR |
        Request::HEADER_X_FORWARDED_HOST |
        Request::HEADER_X_FORWARDED_PORT |
        Request::HEADER_X_FORWARDED_PROTO |
        Request::HEADER_X_FORWARDED_AWS_ELB;

   //  protected $headers = Request::HEADER_X_FORWARDED_ALL; 
}
